/**
 * Copyright (C) 2019 Bonitasoft S.A.
 * Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble
 * This library is free software; you can redistribute it and/or modify it under the terms
 * of the GNU Lesser General Public License as published by the Free Software Foundation
 * version 2.1 of the License.
 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public License along with this
 * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
 * Floor, Boston, MA 02110-1301, USA.
 **/
package org.bonitasoft.engine.expression;

import static java.lang.String.format;

import org.assertj.core.api.AbstractAssert;

/**
 * {@link SimpleBizData} specific assertions - Generated by CustomAssertionGenerator.
 */
public class SimpleBizDataAssert extends AbstractAssert<SimpleBizDataAssert, SimpleBizData> {

    /**
     * Creates a new </code>{@link SimpleBizDataAssert}</code> to make assertions on actual SimpleBizData.
     *
     * @param actual the SimpleBizData we want to make assertions on.
     */
    public SimpleBizDataAssert(SimpleBizData actual) {
        super(actual, SimpleBizDataAssert.class);
    }

    /**
     * An entry point for SimpleBizDataAssert to follow AssertJ standard <code>assertThat()</code> statements.<br>
     * With a static import, one's can write directly : <code>assertThat(mySimpleBizData)</code> and get specific
     * assertion with code completion.
     *
     * @param actual the SimpleBizData we want to make assertions on.
     * @return a new </code>{@link SimpleBizDataAssert}</code>
     */
    public static SimpleBizDataAssert assertThat(SimpleBizData actual) {
        return new SimpleBizDataAssert(actual);
    }

    /**
     * Verifies that the actual SimpleBizData's id is equal to the given one.
     *
     * @param id the given id to compare the actual SimpleBizData's id to.
     * @return this assertion object.
     * @throws AssertionError - if the actual SimpleBizData's id is not equal to the given one.
     */
    public SimpleBizDataAssert hasId(Long id) {
        // check that actual SimpleBizData we want to make assertions on is not null.
        isNotNull();

        // we overrides the default error message with a more explicit one
        String errorMessage = format("\nExpected <%s> id to be:\n  <%s>\n but was:\n  <%s>", actual, id,
                actual.getId());

        // check
        if (!actual.getId().equals(id)) {
            throw new AssertionError(errorMessage);
        }

        // return the current assertion for method chaining
        return this;
    }

    /**
     * Verifies that the actual SimpleBizData's persistenceId is equal to the given one.
     *
     * @param persistenceId the given persistenceId to compare the actual SimpleBizData's persistenceId to.
     * @return this assertion object.
     * @throws AssertionError - if the actual SimpleBizData's persistenceId is not equal to the given one.
     */
    public SimpleBizDataAssert hasPersistenceId(Long persistenceId) {
        // check that actual SimpleBizData we want to make assertions on is not null.
        isNotNull();

        // we overrides the default error message with a more explicit one
        String errorMessage = format("\nExpected <%s> persistenceId to be:\n  <%s>\n but was:\n  <%s>", actual,
                persistenceId, actual.getPersistenceId());

        // check
        if (!actual.getPersistenceId().equals(persistenceId)) {
            throw new AssertionError(errorMessage);
        }

        // return the current assertion for method chaining
        return this;
    }

    /**
     * Verifies that the actual SimpleBizData's persistenceVersion is equal to the given one.
     *
     * @param persistenceVersion the given persistenceVersion to compare the actual SimpleBizData's persistenceVersion
     *        to.
     * @return this assertion object.
     * @throws AssertionError - if the actual SimpleBizData's persistenceVersion is not equal to the given one.
     */
    public SimpleBizDataAssert hasPersistenceVersion(Long persistenceVersion) {
        // check that actual SimpleBizData we want to make assertions on is not null.
        isNotNull();

        // we overrides the default error message with a more explicit one
        String errorMessage = format("\nExpected <%s> persistenceVersion to be:\n  <%s>\n but was:\n  <%s>", actual,
                persistenceVersion, actual.getPersistenceVersion());

        // check
        if (!actual.getPersistenceVersion().equals(persistenceVersion)) {
            throw new AssertionError(errorMessage);
        }

        // return the current assertion for method chaining
        return this;
    }

}
